const { defineConfig } = require("@vue/cli-service")
module.exports = defineConfig({
	transpileDependencies: true,
	// pluginOptions: { electronBuilder: { nodeIntegration: true } },
	devServer: {
		port: 8888,
	},
	css: {
		extract: process.env.NODE_ENV === "production" ? true : false,
		loaderOptions: {
			scss: {
				// sass-loader@7 => data, sass-loader@11 => prependData, sass-loader@12 => additionalData
				additionalData: `@import "@/styles/main.scss";@import "@/styles/color.scss";@import "@/styles/font.scss";@import "@/styles/animate.scss";`,
			},
		},
	},
	configureWebpack: {
		externals: {
			electron: 'require("electron")',
		},
	},
	pwa: {
		// 一些基础配置
		name: "货物流通管理系统",
		themeColor: "#6476DB",
		msTileColor: "#000000",
		appleMobileWebAppCapable: "yes",
		appleMobileWebAppStatusBarStyle: "black",

		/*
		 * 两个模式，GenerateSW（默认）和 InjectManifest
		 * GenerateSW: build项目时候，每次都会新建一个service worker文件
		 * InjectManifest: 自定义的service worker文件，并且可以处理预缓存列表
		 */
		workboxPluginMode: "InjectManifest",
		workboxOptions: {
			// 自定义的service worker文件的位置
			// swSrc: "src/service-worker.js",
			// ...other Workbox options...
			importWorkboxFrom: "disabled", // 是否要引入线上的service-worker文件，我们只需要自己定义的文件，不需要谷歌提供的sw文件
		},
	},
})

